﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:Moonwish.Silverlight.OsAvatar.Windows">
<SolidColorBrush Color="#99FFFFFF" x:Key="ButtonArea_InnerBorderBrush" />
    <SolidColorBrush Color="#4C000000" x:Key="ButtonArea_OuterBorderBrush" />
    <LinearGradientBrush x:Key="HeaderButton_FillBrush" EndPoint="0.5,1" StartPoint="0.5,0">
        <GradientStop Color="#FFFDFDFD" Offset="0" />
        <GradientStop Color="#FFDDDDDD" Offset="0.5" />
    </LinearGradientBrush>
    <SolidColorBrush Color="#7F000000" x:Key="HeaderButton_StrokeBrush" />
    <LinearGradientBrush x:Key="HeaderButton_NormalBackgroundBrush" EndPoint="0.5,1" StartPoint="0.5,0">
        <GradientStop Color="#00000000" Offset="0"/>
        <GradientStop Color="#0F000000" Offset="0.5"/>
        <GradientStop Color="#30000000" Offset="0.5"/>
        <GradientStop Color="#14000000" Offset="0.845"/>
        <GradientStop Color="#19FFFFFF" Offset="1"/>
    </LinearGradientBrush>
    <LinearGradientBrush x:Key="CloseButton_NormalBackgroundBrush" EndPoint="0.5,1" StartPoint="0.5,0">
        <GradientStop Color="#FFF4CAC2" Offset="0" />
        <GradientStop Color="#FFCC7D6D" Offset="0.5" />
        <GradientStop Color="#FFB94630" Offset="0.5" />
        <GradientStop Color="#FFF4B19C" Offset="1" />
        <GradientStop Color="#FFBE7360" Offset="0.85" />
    </LinearGradientBrush>
    <LinearGradientBrush x:Key="HeaderButton_OverBackgroundBrush" EndPoint="0.5,1" StartPoint="0.5,0">
        <GradientStop Color="#FFBBDDF5" Offset="0"/>
        <GradientStop Color="#FF80B4D6" Offset="0.5"/>
        <GradientStop Color="#FF1C75A9" Offset="0.5"/>
        <GradientStop Color="#FF389CC9" Offset="0.85"/>
        <GradientStop Color="#FF29DDE8" Offset="1"/>
    </LinearGradientBrush>
    <LinearGradientBrush x:Key="CloseButton_OverBackgroundBrush" EndPoint="0.5,1" StartPoint="0.5,0">
        <GradientStop Color="#FFF2C7BF" Offset="0" />
        <GradientStop Color="#FFE5715D" Offset="0.5" />
        <GradientStop Color="#FFB62107" Offset="0.5" />
        <GradientStop Color="#FFF1D86C" Offset="1" />
        <GradientStop Color="#FFD26324" Offset="0.85" />
    </LinearGradientBrush>
    <LinearGradientBrush x:Key="HeaderButton_PressedBackgroundBrush" EndPoint="0.5,1" StartPoint="0.5,0">
        <GradientStop Color="#FFA2C1D4" Offset="0"/>
        <GradientStop Color="#FF4C7992" Offset="0.5"/>
        <GradientStop Color="#FF092847" Offset="0.5"/>
        <GradientStop Color="#FF1A5F80" Offset="0.85"/>
        <GradientStop Color="#FF12E7DE" Offset="1"/>
    </LinearGradientBrush>
    <LinearGradientBrush x:Key="CloseButton_PressedBackgroundBrush" EndPoint="0.5,1" StartPoint="0.5,0">
        <GradientStop Color="#FFC6A18A" Offset="0" />
        <GradientStop Color="#FF974126" Offset="0.5" />
        <GradientStop Color="#FF5E1002" Offset="0.5" />
        <GradientStop Color="#FFE6BA15" Offset="1" />
        <GradientStop Color="#FF764708" Offset="0.85" />
    </LinearGradientBrush>
    <LinearGradientBrush x:Key="CloseButton_ShadowStrokeBrush" EndPoint="0.5,1" StartPoint="0.5,0"
			MappingMode="RelativeToBoundingBox">
        <GradientStop Color="#99FB631D" Offset="0.19" />
        <GradientStop Color="#99FB631D" Offset="0.82" />
        <GradientStop Color="#00FB631D" Offset="1" />
        <GradientStop Color="#00FB631D" Offset="0" />
        <GradientStop Color="#00FB631D" Offset="0.19" />
        <GradientStop Color="#00FB631D" Offset="0.803" />
    </LinearGradientBrush>
    <LinearGradientBrush x:Key="CloseButton_ShadowStroke2Brush" EndPoint="0.5,1" StartPoint="0.5,0"
			MappingMode="RelativeToBoundingBox">
        <GradientStop Color="#99F77032" Offset="0.172" />
        <GradientStop Color="#99F67C43" Offset="0.82" />
        <GradientStop Color="#00FF5000" Offset="1" />
        <GradientStop Color="#00FB631D" Offset="0.06" />
        <GradientStop Color="#00FF5000" Offset="0.172" />
        <GradientStop Color="#00FF5000" Offset="0.92" />
    </LinearGradientBrush>
    <LinearGradientBrush x:Key="CloseButton_ShadowOpacityMaskBrush" EndPoint="0,0.5" StartPoint="1,0.5"
			MappingMode="RelativeToBoundingBox">
        <GradientStop Color="#99FFFFFF" Offset="0.09" />
        <GradientStop Color="#99FFFFFF" Offset="0.861" />
        <GradientStop Color="#00FFFFFF" Offset="0" />
        <GradientStop Color="#00FFFFFF" Offset="0.98682502596053989" />
    </LinearGradientBrush>
    <LinearGradientBrush x:Key="HeaderButton_ShadowStrokeBrush" EndPoint="0.5,1" StartPoint="0.5,0" MappingMode="RelativeToBoundingBox">
        <GradientStop Color="#FF00D2FF" Offset="0.19"/>
        <GradientStop Color="#FF00D2FF" Offset="0.753"/>
        <GradientStop Color="#0000D2FF" Offset="1"/>
        <GradientStop Color="#0000D2FF" Offset="0"/>
        <GradientStop Color="#0000D2FF" Offset="0.19"/>
        <GradientStop Color="#0000D2FF" Offset="0.752"/>
    </LinearGradientBrush>
    <LinearGradientBrush x:Key="HeaderButton_ShadowStroke2Brush" EndPoint="0.5,1" StartPoint="0.5,0" MappingMode="RelativeToBoundingBox">
        <GradientStop Color="#FF00D2FF" Offset="0.19"/>
        <GradientStop Color="#FF00D2FF" Offset="0.81"/>
        <GradientStop Color="#0000D2FF" Offset="0.94"/>
        <GradientStop Color="#0000D2FF" Offset="0.06"/>
        <GradientStop Color="#0000D2FF" Offset="0.19"/>
        <GradientStop Color="#0000D2FF" Offset="0.791"/>
    </LinearGradientBrush>
    <LinearGradientBrush x:Key="HeaderButton_ShadowOpacityMaskBrush" EndPoint="0,0.5" StartPoint="1,0.5"
			MappingMode="RelativeToBoundingBox">
        <GradientStop Color="#E5FFFFFF" Offset="0.15" />
        <GradientStop Color="#E5FFFFFF" Offset="0.85" />
        <GradientStop Color="#00FFFFFF" Offset="0" />
        <GradientStop Color="#00FFFFFF" Offset="0.98682502596053989" />
    </LinearGradientBrush>
    <Style x:Key="WindowHeaderButtonStyle" TargetType="Button">
        <Setter Property="IsEnabled" Value="true" />
        <Setter Property="IsTabStop" Value="false" />
        <Setter Property="MinWidth" Value="5" />
        <Setter Property="MinHeight" Value="5" />
        <Setter Property="Margin" Value="0" />
        <Setter Property="HorizontalContentAlignment" Value="Center" />
        <Setter Property="VerticalContentAlignment" Value="Center" />
        <Setter Property="Cursor" Value="Arrow" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <Grid>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Unfocused">
                                </VisualState>
                                <VisualState x:Name="Focused">
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Duration="0"
												Storyboard.TargetName="OuterBorder"
												Storyboard.TargetProperty="Background">
                                            <DiscreteObjectKeyFrame KeyTime="0"
													Value="{StaticResource HeaderButton_OverBackgroundBrush}" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Duration="0"
												Storyboard.TargetName="ShadowOver"
												Storyboard.TargetProperty="(UIElement.Visibility)">
                                            <DiscreteObjectKeyFrame KeyTime="0"
													Value="Visible" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Pressed">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Duration="0"
												Storyboard.TargetName="OuterBorder"
												Storyboard.TargetProperty="Background">
                                            <DiscreteObjectKeyFrame KeyTime="0"
													Value="{StaticResource HeaderButton_PressedBackgroundBrush}" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Duration="0"
												Storyboard.TargetName="ShadowOver"
												Storyboard.TargetProperty="(UIElement.Visibility)">
                                            <DiscreteObjectKeyFrame KeyTime="0"
													Value="Visible" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled">
                                </VisualState>
                                <VisualState x:Name="Normal">
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Border BorderBrush="{StaticResource ButtonArea_OuterBorderBrush}" Width="25" HorizontalAlignment="Left"  BorderThickness="0 0 1 0">
                            <Border x:Name="OuterBorder" 
								Background="{StaticResource HeaderButton_NormalBackgroundBrush}"
								CornerRadius="0,0,0,0"  >
                                <Border   CornerRadius="0,0,0,0" BorderBrush="#99FFFFFF" BorderThickness="1" />
                            </Border>
                        </Border>
                        <ContentPresenter Content="{TemplateBinding Content}"
								ContentTemplate="{TemplateBinding ContentTemplate}" />

                        <StackPanel Visibility="Collapsed" x:Name="ShadowOver" Width="34.175"
								Height="36.089" Margin="-22 -5 -20 -15">
                            <StackPanel IsHitTestVisible="False">
                                <Rectangle IsHitTestVisible="False"
										Stroke="{StaticResource HeaderButton_ShadowStrokeBrush}"
										OpacityMask="{StaticResource HeaderButton_ShadowOpacityMaskBrush}"
										StrokeThickness="10" HorizontalAlignment="Left" Margin="0"
										VerticalAlignment="Top" Width="34.175" Height="25.915"
										RadiusX="5" RadiusY="5" />
                                <Rectangle IsHitTestVisible="False"
										Stroke="{StaticResource HeaderButton_ShadowStroke2Brush}"
										StrokeThickness="10" HorizontalAlignment="Left"
										Margin="9 -33 -8 0" VerticalAlignment="Top" Width="16.163"
										Height="36.415" RenderTransformOrigin="0.5,0.5">
                                    <Rectangle.RenderTransform>
                                        <TransformGroup>
                                            <ScaleTransform ScaleX="0.99246469169824569"
													ScaleY="1.0075925202828731" />
                                            <SkewTransform AngleX="0" AngleY="0" />
                                            <RotateTransform Angle="90" />
                                            <TranslateTransform X="0" Y="0" />
                                        </TransformGroup>
                                    </Rectangle.RenderTransform>
                                </Rectangle>
                            </StackPanel>
                        </StackPanel>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="CloseButtonStyle" TargetType="Button">
        <Setter Property="IsEnabled" Value="true" />
        <Setter Property="IsTabStop" Value="false" />
        <Setter Property="MinWidth" Value="5" />
        <Setter Property="MinHeight" Value="5" />
        <Setter Property="Margin" Value="0" />
        <Setter Property="HorizontalContentAlignment" Value="Center" />
        <Setter Property="VerticalContentAlignment" Value="Center" />
        <Setter Property="Cursor" Value="Arrow" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <Grid>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Unfocused">
                                </VisualState>
                                <VisualState x:Name="Focused">
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Duration="0"
												Storyboard.TargetName="OuterBorder"
												Storyboard.TargetProperty="Background">
                                            <DiscreteObjectKeyFrame KeyTime="0"
													Value="{StaticResource CloseButton_OverBackgroundBrush}" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Duration="0"
												Storyboard.TargetName="ShadowOver"
												Storyboard.TargetProperty="(UIElement.Visibility)">
                                            <DiscreteObjectKeyFrame KeyTime="0"
													Value="Visible" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Pressed">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Duration="0"
												Storyboard.TargetName="OuterBorder"
												Storyboard.TargetProperty="Background">
                                            <DiscreteObjectKeyFrame KeyTime="0"
													Value="{StaticResource CloseButton_PressedBackgroundBrush}" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled">
                                </VisualState>
                                <VisualState x:Name="Normal">
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>

                        <Border x:Name="OuterBorder" HorizontalAlignment="Left"
								Width="39"
								Background="{StaticResource CloseButton_NormalBackgroundBrush}"
								CornerRadius="0,0,3,0"  >
                            <Border   CornerRadius="0,0,3,0" BorderBrush="#99FFFFFF" BorderThickness="1" />
                        </Border>

                        <ContentPresenter Content="{TemplateBinding Content}"
								ContentTemplate="{TemplateBinding ContentTemplate}" />

                        <!--mouse HeaderButton_OverBackgroundBrush-->

                        <StackPanel Visibility="Collapsed" x:Name="ShadowOver" Width="53.57"
								Height="41.695" Margin="-20 -4 -20 -15">
                            <Rectangle Stroke="{StaticResource CloseButton_ShadowStrokeBrush}"
									OpacityMask="{StaticResource CloseButton_ShadowOpacityMaskBrush}"
									RadiusX="4" RadiusY="4" StrokeThickness="10"
									HorizontalAlignment="Left" Margin="0" VerticalAlignment="Top"
									Width="53.57" Height="25.915" />
                            <Rectangle Stroke="{StaticResource CloseButton_ShadowStroke2Brush}"
									StrokeThickness="10" HorizontalAlignment="Left"
									Margin="15 -34 0 0" VerticalAlignment="Top" Width="24.046"
									Height="41.695" RenderTransformOrigin="0.5,0.5">
                                <Rectangle.RenderTransform>
                                    <TransformGroup>
                                        <ScaleTransform ScaleX="0.66713942516425861"
												ScaleY="1.4989370471603993" />
                                        <SkewTransform AngleX="0" AngleY="0" />
                                        <RotateTransform Angle="90" />
                                        <TranslateTransform X="0" Y="0" />
                                    </TransformGroup>
                                </Rectangle.RenderTransform>
                            </Rectangle>
                        </StackPanel>

                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style TargetType="local:AvatarWindow">
        <Setter Property="MinHeight" Value="400"/>
        <Setter Property="MinWidth" Value="550"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:AvatarWindow">
                    <Grid Width="{TemplateBinding Width}" Height="{TemplateBinding Height}" x:Name="PART_Window">
                        <!-- Outer shadow -->
                        <Border CornerRadius="4,4,4,4"
                    Background="#FF1F6BB5" 
                    Margin="-2,-2,-2,-2" />
                        <!-- Border with white background -->
                        <Border CornerRadius="2,2,2,2"
                        x:Name="PART_Border"
                    BorderBrush="White" 
                    BorderThickness="1" 
                    Padding="1">
                            <Border.Background>
                                <RadialGradientBrush GradientOrigin="1,1" Center="0.5,0.5">
                                    <GradientStop Color="White"/>
                                    <GradientStop Color="#FF3E9CD0" Offset="0.5"/>
                                </RadialGradientBrush>
                            </Border.Background>
                            <Grid>
                                <VisualStateManager.VisualStateGroups>
                                    <VisualStateGroup x:Name="Animation">
                                        <VisualState x:Name="Dragging" />
                                        <VisualState x:Name="Resizing" />
                                        <VisualState x:Name="Focused" />
                                        <VisualState x:Name="Unfocused" />
                                        <VisualState x:Name="PressedOutsideModal" />
                                        <VisualState x:Name="Opened" />
                                        <VisualState x:Name="Hide" />
                                    </VisualStateGroup>
                                    <VisualStateGroup x:Name="Showing">
                                        <VisualState x:Name="None" />
                                        <VisualState x:Name="OnShow" />
                                    </VisualStateGroup>
                                    <VisualStateGroup x:Name="ResizeMode">
                                        <VisualState x:Name="CanResizeNormal" />
                                        <VisualState x:Name="CanResizeMaximized">
                                            <Storyboard>
                                                <ObjectAnimationUsingKeyFrames Duration="0"
									Storyboard.TargetName="restore"
									Storyboard.TargetProperty="(UIElement.Visibility)">
                                                    <DiscreteObjectKeyFrame KeyTime="0" Value="Visible" />
                                                </ObjectAnimationUsingKeyFrames>
                                                <ObjectAnimationUsingKeyFrames Duration="0"
									Storyboard.TargetName="maximize"
									Storyboard.TargetProperty="(UIElement.Visibility)">
                                                    <DiscreteObjectKeyFrame KeyTime="0"
										Value="Collapsed" />
                                                </ObjectAnimationUsingKeyFrames>
                                            </Storyboard>
                                        </VisualState>
                                        <VisualState x:Name="CanResizeMinimized">
                                            <Storyboard>
                                                <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="maximize"
									Storyboard.TargetProperty="(UIElement.Visibility)">
                                                    <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed" />
                                                </ObjectAnimationUsingKeyFrames>
                                                <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="restore"
									Storyboard.TargetProperty="(UIElement.Visibility)">
                                                    <DiscreteObjectKeyFrame KeyTime="0" Value="Visible" />
                                                </ObjectAnimationUsingKeyFrames>
                                                <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="PART_MaxButton"
									Storyboard.TargetProperty="(UIElement.Visibility)">
                                                    <DiscreteObjectKeyFrame KeyTime="0" Value="Visible" />
                                                </ObjectAnimationUsingKeyFrames>
                                                <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="PART_MinButton"
									Storyboard.TargetProperty="(UIElement.Visibility)">
                                                    <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed" />
                                                </ObjectAnimationUsingKeyFrames>
                                            </Storyboard>
                                        </VisualState>
                                        <VisualState x:Name="NoResize">
                                            <Storyboard>
                                                <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="PART_MaxButton"
									Storyboard.TargetProperty="(UIElement.Visibility)">
                                                    <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed" />
                                                </ObjectAnimationUsingKeyFrames>
                                                <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="PART_MinButton"
									Storyboard.TargetProperty="(UIElement.Visibility)">
                                                    <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed" />
                                                </ObjectAnimationUsingKeyFrames>
                                            </Storyboard>
                                        </VisualState>
                                        <VisualState x:Name="CanMaximizeNormal">
                                            <Storyboard>
                                                <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="PART_MinButton"
									Storyboard.TargetProperty="(UIElement.Visibility)">
                                                    <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed" />
                                                </ObjectAnimationUsingKeyFrames>
                                            </Storyboard>
                                        </VisualState>
                                        <VisualState x:Name="CanMaximizeMaximized">
                                            <Storyboard>
                                                <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="PART_MinButton"
									Storyboard.TargetProperty="(UIElement.Visibility)">
                                                    <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed" />
                                                </ObjectAnimationUsingKeyFrames>
                                                <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="restore"
									Storyboard.TargetProperty="(UIElement.Visibility)">
                                                    <DiscreteObjectKeyFrame KeyTime="0" Value="Visible" />
                                                </ObjectAnimationUsingKeyFrames>
                                                <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="maximize"
									Storyboard.TargetProperty="(UIElement.Visibility)">
                                                    <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed" />
                                                </ObjectAnimationUsingKeyFrames>
                                            </Storyboard>
                                        </VisualState>
                                        <VisualState x:Name="CanMinimizeNormal">
                                            <Storyboard>
                                                <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="PART_MaxButton"
									Storyboard.TargetProperty="(UIElement.Visibility)">
                                                    <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed" />
                                                </ObjectAnimationUsingKeyFrames>
                                            </Storyboard>
                                        </VisualState>
                                        <VisualState x:Name="CanMinimizeMinimized">
                                            <Storyboard>
                                                <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="PART_MinButton"
									Storyboard.TargetProperty="(UIElement.Visibility)">
                                                    <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed" />
                                                </ObjectAnimationUsingKeyFrames>
                                                <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="PART_MaxButton"
									Storyboard.TargetProperty="(UIElement.Visibility)">
                                                    <DiscreteObjectKeyFrame KeyTime="0" Value="Visible" />
                                                </ObjectAnimationUsingKeyFrames>
                                                <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="restore"
									Storyboard.TargetProperty="(UIElement.Visibility)">
                                                    <DiscreteObjectKeyFrame KeyTime="0" Value="Visible" />
                                                </ObjectAnimationUsingKeyFrames>
                                                <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="maximize"
									Storyboard.TargetProperty="(UIElement.Visibility)">
                                                    <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed" />
                                                </ObjectAnimationUsingKeyFrames>
                                            </Storyboard>
                                        </VisualState>
                                    </VisualStateGroup>
                                    <VisualStateGroup x:Name="CloseMode">
                                        <VisualState x:Name="CloseModeNormal" />
                                        <VisualState x:Name="CloseModeNone">
                                            <Storyboard>
                                                <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="PART_CloseButton"
									Storyboard.TargetProperty="(UIElement.Visibility)">
                                                    <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed" />
                                                </ObjectAnimationUsingKeyFrames>
                                            </Storyboard>
                                        </VisualState>
                                    </VisualStateGroup>
                                </VisualStateManager.VisualStateGroups>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="30" />
                                    <RowDefinition Height="*" />
                                </Grid.RowDefinitions>

                                <local:CaptionBar Grid.Row="0"
									x:Name="PART_CaptionBar" 
									VerticalAlignment="Stretch" 
                                    Caption="{TemplateBinding Caption}"
                                    Favicon="{TemplateBinding Favicon}"
									Cursor="Hand">
                                </local:CaptionBar>
                                <StackPanel Grid.Row="0" Margin="1 0 3 0"
																		HorizontalAlignment="Right"
																		Height="16"
																		VerticalAlignment="Top"
																		Width="Auto"
																		Orientation="Horizontal">
                                    <Button x:Name="PART_MinButton"
																			Style="{StaticResource WindowHeaderButtonStyle}"
																			Height="16" Margin="0"
																			VerticalAlignment="Top">
                                        <Rectangle
																				Stroke="{StaticResource HeaderButton_StrokeBrush}"
																				Fill="{StaticResource HeaderButton_FillBrush}"
																				RadiusX="1" RadiusY="1"
																				HorizontalAlignment="Center"
																				Margin="-1,8.5,0,3.5"
																				Width="12" />
                                    </Button>
                                    <Button x:Name="PART_MaxButton"
																			Style="{StaticResource WindowHeaderButtonStyle}"
																			Height="16"
																			VerticalAlignment="Top"
																			HorizontalAlignment="Right">
                                        <Grid>
                                            <Grid Margin="0"
																					Visibility="Collapsed"
																					VerticalAlignment="Stretch"
																					HorizontalAlignment="Stretch"
																					x:Name="restore">
                                                <Grid x:Name="restorePart1"
																						Visibility="Visible"
																						Height="8"
																						HorizontalAlignment="Left"
																						Margin="8.5,3,0,0"
																						VerticalAlignment="Top"
																						Width="12">
                                                    <Path Stretch="Fill"
																							Stroke="{StaticResource HeaderButton_StrokeBrush}"
																							Fill="{StaticResource HeaderButton_FillBrush}"
																							HorizontalAlignment="Left"
																							Margin="0"
																							Width="8.797"
																							Data="M1.5,0.5 L10.5,0.5 C11.052284,0.5 11.5,0.94771537 11.5,1.5 L11.5,8.5 C11.5,9.0522842 11.052284,9.5 10.5,9.5 L1.5,9.5 C0.94771519,9.5 0.5,9.0522841 0.5,8.5 L0.5,1.5 C0.5,0.94771546 0.9477151,0.5 1.5,0.5 z" />
                                                </Grid>
                                                <Grid x:Name="restorePart2"
																						Height="9"
																						HorizontalAlignment="Left"
																						VerticalAlignment="Top"
																						Width="12"
																						Margin="6.5,5,0,0">
                                                    <Path Stretch="Fill"
																							Stroke="{StaticResource HeaderButton_StrokeBrush}"
																							Fill="{StaticResource HeaderButton_FillBrush}"
																							HorizontalAlignment="Left"
																							Margin="0"
																							Width="8.796"
																							Data="M3.5443635,6.4780002 L8.4556365,6.4780002 8.4556365,3.52 3.5443635,3.52 z M1.5,0.5 L10.5,0.5 C11.052284,0.5 11.5,0.94771537 11.5,1.5 L11.5,8.5 C11.5,9.0522842 11.052284,9.5 10.5,9.5 L1.5,9.5 C0.94771519,9.5 0.5,9.0522841 0.5,8.5 L0.5,1.5 C0.5,0.94771546 0.9477151,0.5 1.5,0.5 z" />
                                                </Grid>
                                            </Grid>
                                            <Grid x:Name="maximize"
																					HorizontalAlignment="Center"
																					VerticalAlignment="Top"
																					Margin="-1 3 0 3"
																					Width="12">
                                                <Path Stretch="Fill"
																						Stroke="{StaticResource HeaderButton_StrokeBrush}"
																						Fill="{StaticResource HeaderButton_FillBrush}"
																						HorizontalAlignment="Center"
																						VerticalAlignment="Center"
																						Margin="0"
																						Width="12"
																						Data="M2.625,3.52 L2.625,6.4780002 9.375,6.4780002 9.375,3.52 2.625,3.52 z M1.5,0.5 L10.5,0.5 C11.052284,0.5 11.5,0.94771537 11.5,1.5 L11.5,8.5 C11.5,9.0522842 11.052284,9.5 10.5,9.5 L1.5,9.5 C0.94771519,9.5 0.5,9.0522841 0.5,8.5 L0.5,1.5 C0.5,0.94771546 0.9477151,0.5 1.5,0.5 z" />
                                            </Grid>
                                        </Grid>
                                    </Button>
                                    <Button x:Name="PART_CloseButton"
																			Style="{StaticResource CloseButtonStyle}"
																			Height="16"
																			HorizontalAlignment="Right"
																			Margin="0"
																			VerticalAlignment="Top"
																			HorizontalContentAlignment="Left"
																			VerticalContentAlignment="Top">
                                        <Grid Width="11"
																				HorizontalAlignment="Center"
																				VerticalAlignment="Top"
																				Margin="0,3,0,3">
                                            <Path Stretch="Fill"
																					Stroke="{StaticResource HeaderButton_StrokeBrush}"
																					Fill="{StaticResource HeaderButton_FillBrush}"
																					HorizontalAlignment="Right"
																					Width="11"
																					Data="M1.7378059,0.5 L2.6141474,0.5 C3.1662261,0.50000006 3.8039908,0.75809938 4.4048114,1.5 4.5550169,1.685475 4.9485269,2.160322 5.4658298,2.7821105 L5.4860015,2.8063081 5.5061731,2.7821105 C6.0234754,2.1603227 6.4169869,1.6854752 6.5671916,1.5 7.1680121,0.75809938 7.805777,0.50000006 8.3578553,0.5 L9.2341971,0.5 C9.7862759,0.50000006 10.979304,0.58072393 10.233824,1.5 9.8610825,1.9596381 8.6079334,3.4697623 7.345519,4.9849148 L7.3238601,5.0108548 9.0990157,7.1366935 C9.6334218,7.7765244 10.052589,8.2784384 10.237003,8.5 10.974663,9.3862554 9.7894541,9.5 9.2373757,9.5 L8.3610196,9.5 C7.8089409,9.5 7.3899587,9.4595025 6.5703706,8.5 6.4679222,8.3800621 6.3116059,8.195097 6.1150331,7.9614411 L5.4860015,7.2116037 4.8569698,7.9614411 C4.6603975,8.195097 4.5040812,8.3800621 4.4016328,8.5 3.5820441,9.4595032 3.1630621,9.5 2.6109833,9.5 L1.7346272,9.5 C1.1825502,9.5 -0.0026579946,9.3862555 0.73499992,8.5 0.91941352,8.2784385 1.338581,7.7765249 1.8729872,7.1366935 L3.6481428,5.0108552 3.6264839,4.9849148 C2.36407,3.4697629 1.1109188,1.9596384 0.73817882,1.5 -0.0073020967,0.58072303 1.1857272,0.50000006 1.7378059,0.5 z" />
                                        </Grid>
                                    </Button>
                                </StackPanel>
                                <!-- Content presenter for hosting the content -->
                                <!-- HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" -->
                               
                                <ScrollViewer x:Name="PART_ScrollContent" Grid.Row="1" Padding="0" BorderThickness="0" Background="Transparent" >
                                    <Border Margin="5" CornerRadius="6, 6, 0, 0">
                                        <Border.Background>
                                            <LinearGradientBrush EndPoint="0.5,0.5" MappingMode="RelativeToBoundingBox" StartPoint="1.5,1.5">
                                                <GradientStop Color="#FF3E9CD0"/>
                                                <GradientStop Color="White" Offset="1"/>
                                            </LinearGradientBrush>
                                        </Border.Background>
                                        <Border.Effect>
                                            <DropShadowEffect ShadowDepth="0" Opacity="0.88"/>
                                        </Border.Effect>
                                        <ContentPresenter x:Name="PART_ContentPresenter" />
                                    </Border>
                                </ScrollViewer>
                            </Grid>
                        </Border>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>
